package com.hyp.mapper;

import com.hyp.pojo.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
@Mapper
public interface UserMapper {
        @Select("select  * from user where WeChatOpenID = #{openId}")
        User findByWeChatOpenID(String openId);
        @Insert("insert into user(wechatopenid, nickname,Gender,AvatarURL, createdat, updatedat) " +
                "values (#{weChatOpenID, jdbcType=VARCHAR}, #{nickName, jdbcType=VARCHAR},#{gender},#{avatarUrl}, #{createdAt, jdbcType=TIMESTAMP}, #{updatedAt, jdbcType=TIMESTAMP})")
        void save(User user);

        @Select("select * from user")
        List<User> list();

        @Delete("delete from user where UserID = #{id}")
        void delete(Integer id);

        @Select("select * from user where UserID = #{id}")
        User getById(Integer id);
        void updataUserinfo(User user);


}
